package com.chima.action;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.struts2.ServletActionContext;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import com.chima.domain.AllRewardPercent;
import com.chima.domain.DepartJobfinace;
import com.chima.domain.Department;
import com.chima.domain.DepartmentCoffer;
import com.chima.domain.DepartmentFinace;
import com.chima.domain.Employees;
import com.chima.domain.Finace;
import com.chima.domain.FinacePercent;
import com.chima.domain.LeaderReward;
import com.chima.domain.MiddleEmpRate;
import com.chima.domain.MiddleReward;
import com.chima.domain.PageRequestBean;
import com.chima.domain.PageResponseBean;
import com.chima.domain.RewardStock;
import com.chima.service.DepartmentFinaceService;
import com.chima.service.DepartmentService;
import com.chima.service.EmployeeService;
import com.chima.service.RateService;
import com.opensymphony.xwork2.ActionSupport;
import flexjson.JSONSerializer;
import flexjson.transformer.DateTransformer;

public class DepartmentFinaceAction extends ActionSupport{
	
	private DepartmentFinaceService deptFinaceService;

	private DepartmentService departmentService;
	private EmployeeService employeeService;
	private RateService rateService;
	
	private int start;// 开始页码
	private int limit; //每页显示
	private int page;//页数
	private boolean success=false ;
	private String searchdate;
	private double reward;
	private List<DepartmentFinace> departmentFinaces;
	
	private int dept;
	private String date;
	
	private String name;
	private double percent;
	private int id;
	
	private double coffe;
	private String department;
	
	private double inpercent;
	private double xzpercent;
	private double  toatalfinace;
	private String year;
	
	public double getToatalfinace() {
		return toatalfinace;
	}
	public void setToatalfinace(double toatalfinace) {
		this.toatalfinace = toatalfinace;
	}
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
	public double getInpercent() {
		return inpercent;
	}
	public void setInpercent(double inpercent) {
		this.inpercent = inpercent;
	}
	public double getXzpercent() {
		return xzpercent;
	}
	public void setXzpercent(double xzpercent) {
		this.xzpercent = xzpercent;
	}
	public double getCoffe() {
		return coffe;
	}
	public void setCoffe(double coffe) {
		this.coffe = coffe;
	}
	public String getDepartment() {
		return department;
	}
	public void setDepartment(String department) {
		this.department = department;
	}
	public void setRateService(RateService rateService) {
		this.rateService = rateService;
	}
	public void setEmployeeService(EmployeeService employeeService) {
		this.employeeService = employeeService;
	}
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getPercent() {
		return percent;
	}

	public void setPercent(double percent) {
		this.percent = percent;
	}

	public int getDept() {
		return dept;
	}

	public void setDept(int dept) {
		this.dept = dept;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public double getReward() {
		return reward;
	}

	public void setReward(double reward) {
		this.reward = reward;
	}

	public void setDepartmentService(DepartmentService departmentService) {
		this.departmentService = departmentService;
	}

	public String getSearchdate() {
		return searchdate;
	}

	public void setSearchdate(String searchdate) {
		this.searchdate = searchdate;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getLimit() {
		return limit;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public void setDeptFinaceService(DepartmentFinaceService deptFinaceService) {
		this.deptFinaceService = deptFinaceService;
	}
	public String  ListDepartmentFinace() throws Exception{
	    PageRequestBean pageRequestBean = new PageRequestBean();
	    DetachedCriteria criteria = DetachedCriteria.forClass(DepartmentFinace.class);
	    if(searchdate==null || "".equals(searchdate)){
			  SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM"); 
		         Calendar   calendar=Calendar.getInstance(); 
		         calendar.setTime(new Date());
		         calendar.set(Calendar.MONTH,calendar.get(Calendar.MONTH)); 
		         String date= sdf.format(calendar.getTime());
			 criteria.add(Restrictions.eq("date",date));
			  pageRequestBean.setDate(date);
	    	
	    }
	    if(searchdate!=null){
	    	 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM"); 
	    	 criteria.add(Restrictions.eq("date",searchdate));
	    	  pageRequestBean.setDate(searchdate);
	    }
	  
	
	    pageRequestBean.setCriteria(criteria);
		pageRequestBean.setStart(start);
		pageRequestBean.setLimit(limit);
		pageRequestBean.setPage(page);
		PageResponseBean pageResponseBean = deptFinaceService.ListDeptFinace(pageRequestBean);
		departmentFinaces=pageResponseBean.getRows();
        int total=0;
        total =pageResponseBean.getTotal();
		// 输出json内容到客户端
        JSONSerializer jsonSerializer = new JSONSerializer();
        jsonSerializer.exclude("*.class");
        jsonSerializer.transform(new DateTransformer("yyyy-MM-dd"),Date.class);
        String resultJson1 = jsonSerializer.deepSerialize(departmentFinaces);  
        String resultJson2 =jsonSerializer.serialize(total);
        String jsonString = "{total:"+resultJson2.toString()+",departmentFinaces:"+resultJson1.toString()+"}";
		ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
		ServletActionContext.getResponse().getWriter().print(jsonString);
		return NONE;
	
  }
	public String  ListDepartmentCoffer() throws Exception{
	    PageRequestBean pageRequestBean = new PageRequestBean();
	    DetachedCriteria criteria = DetachedCriteria.forClass(DepartmentCoffer.class);
	
	    pageRequestBean.setCriteria(criteria);
		pageRequestBean.setStart(start);
		pageRequestBean.setLimit(limit);
		pageRequestBean.setPage(page);
		PageResponseBean pageResponseBean = deptFinaceService.ListDeptCoffer(pageRequestBean);
		List<DepartmentCoffer> departmentCoffers=pageResponseBean.getRows();
        int total=0;
        total =pageResponseBean.getTotal();
		// 输出json内容到客户端
        JSONSerializer jsonSerializer = new JSONSerializer();
        jsonSerializer.exclude("*.class");
        String resultJson1 = jsonSerializer.deepSerialize(departmentCoffers);  
        String resultJson2 =jsonSerializer.serialize(total);
        String jsonString = "{total:"+resultJson2.toString()+",departmentCoffers:"+resultJson1.toString()+"}";
		ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
		ServletActionContext.getResponse().getWriter().print(jsonString);
		return NONE;
	
  }
/**
 * 计算科室奖金
 * @return
 * @throws IOException 
 */
	public String  CountDepartmentFinace() throws IOException {
		
		List<Department> departments=departmentService.findByflag(1);
		double  allcore=0.0;
		for(Department d:departments){
			System.out.println(d.getName()+"====00000000000000000000000000000");
			double deptcore=  deptFinaceService.finddeptcorebydateanddept(searchdate, d);
			System.out.println(d.getName()+"===="+deptcore);
			allcore+=deptcore;
			
			}
		System.out.println("全医院总系数：：=="+allcore);
		if(reward!=0){
			for(Department d:departments){
			 double dc=  deptFinaceService.finddeptcorebydateanddept(searchdate, d);
			 deptFinaceService.savaOrupdate(searchdate, d,reward,allcore,dc);
			}
			this.success=true;
			JSONSerializer jsonSerializer = new JSONSerializer();
			String resultJson =jsonSerializer.serialize(success);
			String jsonString = "{success:"+resultJson.toString()+"}";
			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
			ServletActionContext.getResponse().getWriter().print(jsonString);
		}
		
		return NONE;
	}
/**
 * 显示绩效单元各部分所占比例
 */
	public String finacepercent() throws Exception { 
		List<FinacePercent> finacePercents= deptFinaceService.ListFinacePercent();
			
		JSONSerializer jsonSerializer = new JSONSerializer();
	    String resultJson1 = jsonSerializer.serialize(finacePercents);  
	    String jsonString = "{finacePercents:"+resultJson1.toString()+"}";
		ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
		ServletActionContext.getResponse().getWriter().print(jsonString);
		return NONE;
	}
	
/**
 * 全院绩效绩效占全院收入比例及行政绩效占全院绩效比例
 */
	public String infinacepercent() throws Exception { 
			
			List<AllRewardPercent> allRewardPercents= deptFinaceService.ListinFinacePercent();
				
			JSONSerializer jsonSerializer = new JSONSerializer();
		    String resultJson1 = jsonSerializer.serialize(allRewardPercents);  
		    String jsonString = "{allRewardPercents:"+resultJson1.toString()+"}";
			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
			ServletActionContext.getResponse().getWriter().print(jsonString);
			return NONE;
		}
/**
 * 修改全院绩效绩效占全院收入比例及行政绩效占全院绩效比例
 * 
 */
	public void editinFinacePercent() throws Exception{
		
		AllRewardPercent f=new AllRewardPercent();
		f.setId(id);
		f.setInpercent(inpercent);
		f.setXzpercent(xzpercent);
	    deptFinaceService.updateinFinacePercent(f);
		this.success=true;
		JSONSerializer jsonSerializer = new JSONSerializer();
		String resultJson =jsonSerializer.serialize(success);
		String jsonString = "{success:"+resultJson.toString()+"}";
		ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
		ServletActionContext.getResponse().getWriter().print(jsonString);
	}
	public void addFinacePercent() throws Exception{
		
		FinacePercent f=new FinacePercent();
		f.setName(name);
		f.setPercent(percent);
		deptFinaceService.savaFinacePercent(f);
		this.success=true;
		JSONSerializer jsonSerializer = new JSONSerializer();
		String resultJson =jsonSerializer.serialize(success);
		String jsonString = "{success:"+resultJson.toString()+"}";
		ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
		ServletActionContext.getResponse().getWriter().print(jsonString);
	}
	
	public void editFinacePercent() throws Exception{
		FinacePercent f=new FinacePercent();
		f.setId(id);
		f.setName(name);
		f.setPercent(percent);
	    deptFinaceService.updateFinacePercent(f);
		this.success=true;
		JSONSerializer jsonSerializer = new JSONSerializer();
		String resultJson =jsonSerializer.serialize(success);
		String jsonString = "{success:"+resultJson.toString()+"}";
		ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
		ServletActionContext.getResponse().getWriter().print(jsonString);
	}
	public String deleteFinacePercent(){
		deptFinaceService.deleteFinacePercent(id);
		return NONE;
	}
	
/**
 * 显示绩效各部分奖金
 * 
 */
	public String finace() throws Exception {
		
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM"); 
		Date d= new Date();
		String date=sdf.format(d);
		
		if(searchdate==null){
			List<Finace> finaces= deptFinaceService.listFinace(date);
			JSONSerializer jsonSerializer = new JSONSerializer();
		    String resultJson1 = jsonSerializer.serialize(finaces);  
		    String jsonString = "{finaces:"+resultJson1.toString()+"}";
			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
			ServletActionContext.getResponse().getWriter().print(jsonString);
		}else{
			List<Finace> finaces= deptFinaceService.listFinace(searchdate);
			JSONSerializer jsonSerializer = new JSONSerializer();
		    String resultJson1 = jsonSerializer.serialize(finaces);  
		    String jsonString = "{finaces:"+resultJson1.toString()+"}";
			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
			ServletActionContext.getResponse().getWriter().print(jsonString);
		}
		
		
		return NONE;
	}
/**
 * 一次分配各绩效部分奖金
 * @throws Exception
 */
	public void conutFinace() throws Exception{
		
		List<FinacePercent> finacePercents= deptFinaceService.ListFinacePercent();
		
		if(searchdate!=null && reward!=0){
			AllRewardPercent a=deptFinaceService.FindinFinacePercent();
		    double  totalfinace= a.getInpercent()*0.01*a.getXzpercent()*0.01*reward;
		    //查询奖金存量
			RewardStock rewardStock=deptFinaceService.findRewardStock(searchdate.substring(0, 4));
			// 如果奖金大于存量一多出部分90% 作为增量
			if(totalfinace>rewardStock.getToatalfinace()){
				double  lastfinace=(totalfinace-rewardStock.getToatalfinace())*0.9+rewardStock.getToatalfinace();
				//保存奖金的存量
				double  stockfinace=(totalfinace-rewardStock.getToatalfinace())*0.1;
				DepartJobfinace departJobfinace=new DepartJobfinace();
				departJobfinace.setDate(searchdate);
				departJobfinace.setFinace(stockfinace);
				deptFinaceService.savaorupdateDepartJobfinace(departJobfinace);
				
				for(FinacePercent f:finacePercents){
					
					deptFinaceService.savaOrupdateFinace(f.getName(), searchdate, lastfinace*f.getPercent()*0.01);
				}
			}else{
//				    double  lastfinace=rewardStock.getToatalfinace();
					for(FinacePercent f:finacePercents){
					deptFinaceService.savaOrupdateFinace(f.getName(), searchdate, totalfinace*f.getPercent()*0.01);
				}
			}
			
//			for(FinacePercent f:finacePercents){
//				deptFinaceService.savaOrupdateFinace(f.getName(), searchdate, totalfinace*f.getPercent()/100);
//			}
		}
		this.success=true;
		JSONSerializer jsonSerializer = new JSONSerializer();
		String resultJson =jsonSerializer.serialize(success);
		String jsonString = "{success:"+resultJson.toString()+"}";
		ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
		ServletActionContext.getResponse().getWriter().print(jsonString);
	}
/**
 * 显示院领导奖金
 * 
 */
	public String ListleaderFinace() throws Exception {
			
			SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM"); 
			Date d= new Date();
			String date=sdf.format(d);
			
			if(searchdate==null){
				List<LeaderReward> leaderRewards= deptFinaceService.listLeaderFinace(date);
				JSONSerializer jsonSerializer = new JSONSerializer();
			    String resultJson1 = jsonSerializer.serialize(leaderRewards);  
			    String jsonString = "{leaderRewards:"+resultJson1.toString()+"}";
				ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
				ServletActionContext.getResponse().getWriter().print(jsonString);
			}else{
				List<LeaderReward> leaderRewards= deptFinaceService.listLeaderFinace(searchdate);
				JSONSerializer jsonSerializer = new JSONSerializer();
			    String resultJson1 = jsonSerializer.serialize(leaderRewards);  
			    String jsonString = "{leaderRewards:"+resultJson1.toString()+"}";
				ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
				ServletActionContext.getResponse().getWriter().print(jsonString);
			}
			
			
			return NONE;
		}
/**
 * 显示中层奖金
 * 
 */
	public String ListMiddleFinace() throws Exception {
		
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM"); 
		Date d= new Date();
		String date=sdf.format(d);
		
		if(searchdate==null){
			List<MiddleReward> middleRewards= deptFinaceService.listMiddleReward(date);
			JSONSerializer jsonSerializer = new JSONSerializer();
		    String resultJson1 = jsonSerializer.serialize(middleRewards);  
		    String jsonString = "{middleRewards:"+resultJson1.toString()+"}";
			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
			ServletActionContext.getResponse().getWriter().print(jsonString);
		}else{
			List<MiddleReward> middleRewards= deptFinaceService.listMiddleReward(searchdate);
			JSONSerializer jsonSerializer = new JSONSerializer();
		    String resultJson1 = jsonSerializer.serialize(middleRewards);  
		    String jsonString = "{middleRewards:"+resultJson1.toString()+"}";
			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
			ServletActionContext.getResponse().getWriter().print(jsonString);
		}
		
		
		return NONE;
	}
/**
 * 	计算院领导奖金
 *
 */
	public void conutLeadFinace() throws Exception{
		double  core=0.0;
		List<Employees> ee=employeeService.findEmployeesByDeparmet(36) ;
		if(searchdate!=null && reward!=0){
			for(Employees e:ee){
				
				deptFinaceService.savaOrupdateLeadFinace(e, searchdate, reward);
			}
			this.success=true;
			JSONSerializer jsonSerializer = new JSONSerializer();
			String resultJson =jsonSerializer.serialize(success);
			String jsonString = "{success:"+resultJson.toString()+"}";
			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
			ServletActionContext.getResponse().getWriter().print(jsonString);
		}
		
	}
/**
 * 	计算中层管理者奖金
 *
 */
		public void conutMiddleFinace() throws Exception{
			
			List<Employees> ee=employeeService.findEmployeesByposition(2);
			double totalCoffer=0;
			
			if(searchdate!=null && reward!=0){
				for(Employees e:ee){
					
					MiddleEmpRate r=deptFinaceService.finfMiddleEmpRate(e.getName(), searchdate);
					totalCoffer+=e.getFinaceCoffe()*r.getGrade();
				}
				for(Employees e:ee){
					
					deptFinaceService.savaOrupdateMiddleFinace(e, searchdate, reward, totalCoffer);
					
				}
				this.success=true;
				JSONSerializer jsonSerializer = new JSONSerializer();
				String resultJson =jsonSerializer.serialize(success);
				String jsonString = "{success:"+resultJson.toString()+"}";
				ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
				ServletActionContext.getResponse().getWriter().print(jsonString);
			}
			
		}
/**
 * 修改科室绩效系数
 * @throws Exception
 */
		public void editDeptCoffer() throws Exception{
			DepartmentCoffer f=new DepartmentCoffer();
			f.setId(id);
			f.setCoffe(coffe);
			f.setDepartment(department);
		    deptFinaceService.updateDepartmentCoffer(f);
			this.success=true;
			JSONSerializer jsonSerializer = new JSONSerializer();
			String resultJson =jsonSerializer.serialize(success);
			String jsonString = "{success:"+resultJson.toString()+"}";
			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
			ServletActionContext.getResponse().getWriter().print(jsonString);
		}
/**
 * 科室奖金计算自动显示奖金查询
 * 
 */
	  public String deptfinace() throws Exception {
		    Department  d =departmentService.findById(dept);
			double rewad= deptFinaceService.findDeptfiance(searchdate, d.getName());
			if(rewad!=0){
				
				JSONSerializer jsonSerializer = new JSONSerializer();
		        String resultJson1 = jsonSerializer.serialize(rewad);  
		        String jsonString = "{rewad:"+resultJson1.toString()+"}";
				ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
				ServletActionContext.getResponse().getWriter().print(jsonString);
			}
			
			return NONE;
		}
  /**
   * 院领导奖金计算自动显示奖金查询
   * 
   */
  	  public String Leadfinace() throws Exception {
  			double rewad= deptFinaceService.FindfinaceBydateAndName(searchdate, "院领导");
  			if(rewad!=0){
  				
  				JSONSerializer jsonSerializer = new JSONSerializer();
  		        String resultJson1 = jsonSerializer.serialize(rewad);  
  		        String jsonString = "{rewad:"+resultJson1.toString()+"}";
  				ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
  				ServletActionContext.getResponse().getWriter().print(jsonString);
  			}
  			
  			return NONE;
  		}
/**
 * 普通员工计算奖金是自动显示
 */
  	public String Empfinace() throws Exception {
  		double rewad= deptFinaceService.FindfinaceBydateAndName(searchdate, "普通职工");
			if(rewad!=0){
				JSONSerializer jsonSerializer = new JSONSerializer();
		        String resultJson1 = jsonSerializer.serialize(rewad);  
		        String jsonString = "{rewad:"+resultJson1.toString()+"}";
				ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
				ServletActionContext.getResponse().getWriter().print(jsonString);
			}
			
			return NONE;
		}
  	  
	  public String listRewardStock () throws Exception {
		    
		        List<RewardStock> rewardStocks= deptFinaceService.listRewardStock();
		        int total=rewardStocks.size();
		        JSONSerializer jsonSerializer = new JSONSerializer();
		        jsonSerializer.exclude("*.class");
		        String resultJson1 = jsonSerializer.deepSerialize(rewardStocks);  
		        String resultJson2 =jsonSerializer.serialize(total);
		        String jsonString = "{total:"+resultJson2.toString()+",rewardStocks:"+resultJson1.toString()+"}";
				ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
				ServletActionContext.getResponse().getWriter().print(jsonString);
			
			return NONE;
		}
 /**
   * 修改奖金存量
   * 
   */
	  		public void editRewardStock() throws Exception{
	  			RewardStock f=new RewardStock();
	  			f.setId(id);
	  			f.setToatalfinace(toatalfinace);
	  			f.setYear(year);
	  		    deptFinaceService.editRewardStock(f);
	  			this.success=true;
	  			JSONSerializer jsonSerializer = new JSONSerializer();
	  			String resultJson =jsonSerializer.serialize(success);
	  			String jsonString = "{success:"+resultJson.toString()+"}";
	  			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
	  			ServletActionContext.getResponse().getWriter().print(jsonString);
	  		}
	  		public void addRewardStock() throws Exception{
	  			RewardStock f=new RewardStock();
	 
	  			f.setToatalfinace(toatalfinace);
	  			f.setYear(year);
	  		    deptFinaceService.savaRewardStock(f);
	  			this.success=true;
	  			JSONSerializer jsonSerializer = new JSONSerializer();
	  			String resultJson =jsonSerializer.serialize(success);
	  			String jsonString = "{success:"+resultJson.toString()+"}";
	  			ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
	  			ServletActionContext.getResponse().getWriter().print(jsonString);
	  		}
/**
 * 项目化工作奖金
 *
 */
	public String  ListDepartJobfinace() throws Exception{
	    PageRequestBean pageRequestBean = new PageRequestBean();
	    DetachedCriteria criteria = DetachedCriteria.forClass(DepartJobfinace.class);
	
	    pageRequestBean.setCriteria(criteria);
		pageRequestBean.setStart(start);
		pageRequestBean.setLimit(limit);
		pageRequestBean.setPage(page);
		PageResponseBean pageResponseBean = deptFinaceService.ListListDepartJobfinace(pageRequestBean);
		List<DepartJobfinace> departJobfinaces=pageResponseBean.getRows();
	    int total=0;
	    total =departJobfinaces.size();
		// 输出json内容到客户端
	    JSONSerializer jsonSerializer = new JSONSerializer();
	    jsonSerializer.exclude("*.class");
	    String resultJson1 = jsonSerializer.deepSerialize(departJobfinaces);  
	    String resultJson2 =jsonSerializer.serialize(total);
	    String jsonString = "{total:"+resultJson2.toString()+",departJobfinaces:"+resultJson1.toString()+"}";
		ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");
		ServletActionContext.getResponse().getWriter().print(jsonString);
		return NONE;
	
	}
}
